package top.iflyoung.cim.biz.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.iflyoung.cim.biz.entity.ChatFriendship;
import top.iflyoung.cim.biz.mapper.ChatFriendshipMapper;
import top.iflyoung.cim.biz.service.ChatFriendshipService;
import top.iflyoung.cim.common.util.VerifyUtil;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * @author liguiyang
 * @description
 * @sine 1.8
 * @date 2021/9/49:09
 **/
@Service("chatFriendshipService")
public class ChatFriendshipServiceImpl extends ServiceImpl<ChatFriendshipMapper, ChatFriendship> implements ChatFriendshipService {

    @Override
    public List<ChatFriendship> findAllReachableUsers(@NotNull Long userId) {
        List<ChatFriendship> shipList = new ArrayList<>();
        if (!VerifyUtil.isEmpty(userId)) {
            shipList.addAll(baseMapper.queryAllReachableUsers(userId));
        }
        return shipList;
    }
}
